package com.chennan.pattern.bridge.source.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * @author chennan
 * @create 2021-10
 */
public class Test {

    public static void main(String[] args) {
        try {
            //1、加载驱动
            Class.forName("com.mysql.jdbc.Driver");
            //2、获取链接
            Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306");
            //3、得到执行sql语句的对象Statement
            Statement statement = connection.createStatement();
            //4、执行sql语句，并返回结果
            ResultSet resultSet = statement.executeQuery("select * from book");
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
